package com.ossean.match.dao;

import java.text.MessageFormat;
import java.util.List;
import java.util.Map;

import com.ossean.match.model.RelativeMemoToOpenSourceProject;

public class RelativeMemoToOpenSourceProjectDaoProvider {
	public String insertAll(Map map) {  
        List<RelativeMemoToOpenSourceProject> list = (List<RelativeMemoToOpenSourceProject>) map.get("list");
        String tableName = (String) map.get("targetTableName");
        StringBuilder sb = new StringBuilder();  
        sb.append("INSERT INTO "+tableName+" ");  
        sb.append("(osp_id,relative_memo_id,match_weight,match_time) ");  
        sb.append("VALUES ");  
        MessageFormat mf = new MessageFormat("(#'{'list[{0}].osp_id},#'{'list[{0}].relative_memo_id},#'{'list[{0}].match_weight},now())");  
        for (int i = 0; i < list.size(); i++) {  
            sb.append(mf.format(new Integer[]{i}));  
            if (i < list.size() - 1) {  
                sb.append(",");  
            }  
        }  
        return sb.toString();  
    }  

}
